#include <stdio.h>
#include <stdlib.h>
#include <time.h>

// 生成并打印红球号码（1-33 之间不重复的 6 个数字）
void generateRedBalls(int redBalls[]) {
    int i, j, num;
    for (i = 0; i < 6; ) {
        num = rand() % 33 + 1;
        int isDuplicate = 0;
        for (j = 0; j < i; j++) {
            if (redBalls[j] == num) {
                isDuplicate = 1;
                break;
            }
        }
        if (!isDuplicate) {
            redBalls[i++] = num;
        }
    }
}

// 生成并打印蓝球号码（1-16 之间的一个数字）
int generateBlueBall() {
    return rand() % 16 + 1;
}

// 打印双色球号码
void printLotteryNumbers(int redBalls[], int blueBall) {
    printf("红球：");
    for (int i = 0; i < 6; i++) {
        printf("%d ", redBalls[i]);
    }
    printf("\n蓝球：%d\n", blueBall);
}

int main() {
    srand((unsigned int)time(NULL));  // 初始化随机数种子

    int redBalls[6];
    int blueBall;

    generateRedBalls(redBalls);
    blueBall = generateBlueBall();

    printLotteryNumbers(redBalls, blueBall);

    return 0;
}
